using System.Net;
using System.Net.Quic;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using eLibrary;
using eTask;
using Letter.Net.Session;
using SQuicConnection = System.Net.Quic.QuicConnection;

namespace Letter.Net.Quic;

sealed class QuicConnection : IQuicConnection
{
    [RequiresPreviewFeatures]
    public QuicConnection(SQuicConnection connection)
    {
        this.Id = StringIdGenerator.GetNextId();
        this.connection = connection;
    }

    [RequiresPreviewFeatures]
    private SQuicConnection connection;
    
    public string Id { get; }
    public bool Active { get; }

    public EndPoint LocalEndPoint
    {
        [RequiresPreviewFeatures]
        get { return connection.LocalEndPoint; }
    }

    public EndPoint RemoteEndPoint
    {
        [RequiresPreviewFeatures]
        get { return this.connection.RemoteEndPoint; }
    }

    [RequiresPreviewFeatures]
    public ValueTask<ISession> GetInboundAsync(QuicStreamType streamType)
    {
        throw new System.NotImplementedException();
    }

    [RequiresPreviewFeatures]
    public ValueTask<ISession> GetOutboundAsync(QuicStreamType streamType)
    {
        throw new System.NotImplementedException();
    }

    public ValueTask CloseAsync()
    {
        // this.connection.CloseAsync();
        return ValueTasks.CompletedTask;
    }
}